package com.example.dubbo.consumer.web.controller;

import static com.outstanding.framework.container.springmvc.WebLogUtils.debug;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.dubbo.config.annotation.Reference;
import com.example.dubbo.api.DemoFacade;
import com.example.dubbo.api.ReqDTO;
import com.example.dubbo.api.ResDTO;
import com.outstanding.framework.core.Context;
import com.outstanding.framework.core.PendingException;




@Controller
@RequestMapping("/")
public class DemoController {

	
	//注意这里是@Reference而不是@Autowired,如果provider有版本号，则必须带上版本号。否则会出现forbid的情况
	@Reference(version="1.0.0")	
	private DemoFacade facade;
	/**
	 * Title: query<br/>
	 * Description: <br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/get.do")
	public @ResponseBody String getInfo() throws PendingException {
		debug("调用getInfo");
		ReqDTO dto = new ReqDTO();
		ResDTO res = this.facade.get(dto);
		
		return res.getMsgInf();
	}
}
